import request from "@/request/api";
/* ----------------计划检修工单---------------- */

//查询分页列表
export function getListApi(data) {
  return request({
    url: "/eam-service-order/repair/queryList",
    method: "get",
    params: data,
  });
}
//查询单个工单
export function getDetailsApi(id = "") {
  return request({
    url: "/eam-service-order/repair/queryById",
    method: "get",
    params: {
      id
    },
  });
}

//提交工单(没有要保存的信息时)
export function submitApi(data) {
  return request({
    url: "/eam-service-order/repair/submitRepair",
    method: "get",
    params: data,
  });
}
//新增
export function saveOrUpdate(data) {
  return request({
    url: "/eam-service-order/repair/insertOrUpdate",
    method: "post",
    data: data,
  });
}
//删除单个工单
export function deleteApi(id = '') {
  return request({
    url: "/eam-service-order/repair/deleteById",
    method: "delete",
    params: {
      id
    },
  });
}
/* 更新签名信息 */
export function updateSignInfo(data) {
  return request({
    url: "/eam-service-order/repair/execute/insertOrderSignInfo",
    method: "put",
    data: data,
  });
}

/* ----------------派工信息---------------- */
//获取派工信息
export function getDispatchApi(data) {
  return request({
    url: "/eam-service-order/repair/dispatch/queryDispatchInfoByOrderId",
    method: "get",
    params: data,
  });
}
//保存派工信息
export function saveDispatchApi(data) {
  return request({
    url: "/eam-service-order/repair/dispatch/saveDispatchInfo",
    method: "post",
    data: data,
  });
}
/* ----------------执行信息---------------- */
//获取作业表单信息
export function getWorkListApi(orderId = "") {
  return request({
    url: "/eam-service-order/repair/execute/queryByOrderId",
    method: "get",
    params: {
      orderId
    },
  });
}
//根据工单Id查询作业表单-设备信息列表信息
export function getWorkDeviceListApi(orderId = "") {
  return request({
    url: "/eam-service-order/repair/execute/queryEquipmentBeanListByOrderId",
    method: "get",
    params: {
      orderId
    },
  });
}
//根据工单Id查询作业表单-设备以及下属项目列表信息
export function getDeviceListApi(orderId = "") {
  return request({
    url: "/eam-service-order/repair/execute/queryEquipmentVoByOrderId",
    method: "get",
    params: {
      orderId
    },
  });
}
//根据工单Id查询作业表单-作业指导书信息
export function getInstructionApi(orderId = "") {
  return request({
    url: "/eam-service-order/repair/execute/queryInstructionByOrderId",
    method: "get",
    params: {
      orderId
    },
  });
}
//根据工单Id,设备id查询作业表单-设备下项目信息列表信息
export function getDeviceTableApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/queryRepairItemByEqId",
    method: "get",
    params: data,
  });
}
//根据工单Id查询作业表单-作业准备信息
export function getWorkReadyApi(orderId = "") {
  return request({
    url: "/eam-service-order/repair/execute/queryReadyByOrderId",
    method: "get",
    params: {
      orderId
    },
  });
}
/* ----------------执行信息--即使更新---------------- */
//更新作业表单-作业过程-项目信息
export function saveItemApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/updateRepairItem",
    method: "put",
    data: data,
  });
}
//更新作业表单-作业过程-参数项值信息(数据记录项修改)
export function saveItemParamsApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/updateRepairItemParams",
    method: "put",
    data: data,
  });
}
//更新作业表单-作业准备信息
export function saveReadyApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/updateRepairReady",
    method: "put",
    data: data,
  });
}
//更新作业表单-作业过程信息
export function saveProcessApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/updateRepairItemVo",
    method: "put",
    data: data,
  });
}
//新增或更新作业表单信息(单独)
export function saveOperateFormItemApi(data) {
  return request({
    url: "/eam-service-order/repair/execute/updateRepairInfo",
    method: "put",
    data: data,
  });
}